
import com.github.wxpay.sdk.WXPayUtil;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

public class wxPayUtil {

    @Test
    public void demo1() throws Exception {
        //随机字符串
        String str = WXPayUtil.generateNonceStr();
        System.out.println("随机字符串"+str);

        //map赚xml
        Map<String,String> map = new HashMap<>();
        map.put("one","汽车");
        map.put("two","火车");
        map.put("three","大炮");
        String mapToXml = WXPayUtil.mapToXml(map);
        System.out.println("map转xml"+mapToXml);

        //将xml转为map
        Map<String, String> map1 = WXPayUtil.xmlToMap(mapToXml);
        System.out.println("xml转map"+map1);
        //map转xml 并且生成签名
        String wjrSign = WXPayUtil.generateSignedXml(map, "wjr");
        System.out.println(wjrSign);

    }
}
